package lesson4.pages.locators.site;

import static lesson4.api.helpers.PageHelper.INDEX_PAGE;

import java.util.Map;

import lesson4.api.ApplicationManager;
import lesson4.api.base.LocatorBase;
import lesson4.api.models.LocatorModel;
import lesson4.pages.locators.page.PageLocators;




public class ForumLocators extends LocatorBase implements SiteLocators
{
	// Application manager instance
	private final ApplicationManager app;

	public ForumLocators(ApplicationManager p_app)
	{
		super(p_app);
		app = p_app;
	}

	// Index Page Locators
	public class IndexPageLocators implements PageLocators
	{
		@Override
		public void setPage()
		{
			setLocator("page", "url", "/");
		}

		@Override
		public void setLocators()
		{
			setLocator("txtLogin", "name", "user");
			setLocator("txtPassword", "name", "passwrd");
			setLocator("btnLogin", "css", "input[type=\"submit\"]");
		}

		@Override
		public Map<String, LocatorModel> getLocators()
		{
			setPage();
			setLocators();
			return locators;
		}
	}

	@Override
	public PageLocators getPageLocators()
	{
		if (app.testPage.contains(INDEX_PAGE))
		{
			return new IndexPageLocators();
		}

		return null;
	}

}
